#include "BulletMgr.h"
#include "Bullet.h"
#include "GameScene.h"
#include "DataConfigMgr.h"
#include "Prefabs.h"
#include "Utils.h"
CBulletMgr::CBulletMgr()
{
}

CBulletMgr::~CBulletMgr()
{
}

bool CBulletMgr::init()
{
	if (!Node::init()){
		return false;
	}
	CBulletData* bulletDt = CDataConfigMgr::getInstance()->getConfigMgr("BulletConfigMgr")->getDataByID<CBulletData*>(3001);
	CUtils::getInstance()->initAnimation(bulletDt->vecDestoryImg, "bulletDestory");
	return true;
}

void CBulletMgr::instanBullet(int id,float radian, Vec2 pos , bool isPlayer)
{

	//TODO
	CBulletData* bulletDt = CDataConfigMgr::getInstance()->getConfigMgr("BulletConfigMgr")->getDataByID<CBulletData*>(id);
	pos = this->convertToNodeSpaceAR(pos);
	CBullet* bullet = CBullet::createWithDt(bulletDt,radian, pos ,isPlayer);
	this->addChild(bullet);
}
